package com.yst.webplugin.annotation;

import java.io.Serializable;
import java.lang.annotation.*;

/**
 *create declare
 */
@ResultType(returnModelClass = true)
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Create {
    /**
     * model class to be create
     */
    Class<? extends Serializable> modelClass() default Default.class;
    /**
     * class of valid parameter
     */
    Class<? extends Serializable> validClass() default Default.class;
    Class<?>[] validClassGroup() default {};
    String keyField() default "id";

    /**
     * can not save fields
     * @return array of field name
     */
    String[] notSaveFields() default {};
    /**
     * time of create
     */
    String createTimeField() default "createTime";

    /**
     * user'id field of create
     */
    String createUserIdField() default "createUserId";

    /**
     * callback before save
     */
    Class<? extends BeforeSave> onBeforeSave() default BeforeSave.class;

    /**
     * callback after save
     */
    Class<? extends AfterSave> onAfterSave() default AfterSave.class;
}
